#include <iostream>
#include <string>
using namespace std;

class Person {
public:
  Person(string name = "tom", size_t age= 180): _name(name), _age(age) {}
  ~Person(){}
  void Print() {
    cout << "name: " << _name << " " << "age: " << _age << endl;
  }

  Person& operator=(const Person& p) {
    if(this != &p) {
      _name = p._name;
      _age = p._age;
      cout << "operator=!!!" << endl;
      return *this;
    }
  }


private:
  string _name;
  size_t _age;

};
int main()
{
  Person p1;
  p1.Print();
  Person p2("tony", 18);
  p2.Print();
  // 你自己不写赋值重载，编译器会自动按照 内置类型值拷贝，自定义类型调用其赋值重载 的规则生成默认的赋值重载
  p1.Print();

  return 0;
}
// 1. crtl + V
// h j k l
// 2. shift + I
 
  
  
  
  
  
  
  
  
